package com.seveneight.baijiesteward.ui.first.model;

import com.seveneight.baijiesteward.bean.BaseEntity;
import com.seveneight.baijiesteward.bean.VersionBean;
import com.seveneight.baijiesteward.http.BaseModel;
import com.seveneight.baijiesteward.http.MyCallBack;
import com.seveneight.baijiesteward.http.RetrofitFactory;
import com.seveneight.baijiesteward.http.XObserver;
import com.seveneight.baijiesteward.ui.first.contract.VersionUpdateContract;

/**
 * Created by user1 on 2018/3/31.
 */

public class VersionUpdateModel extends BaseModel implements VersionUpdateContract.VersionUpdateModel {
    @Override
    public void getVersionInfo(MyCallBack<VersionBean> myCallBack) {
        RetrofitFactory.getInstence().API().getVersionInfo().
                compose(this.<BaseEntity<VersionBean>>setThread()).
                subscribe(new XObserver<VersionBean>() {
                    @Override
                    protected void onSuccees(BaseEntity<VersionBean> t) throws Exception {
                        myCallBack.onSuccess(t.getData());
                    }

                    @Override
                    protected void onFailure(Throwable e, boolean isNetWorkError) throws Exception {

                    }
                });
    }
}
